#region Header
//=============================================================================
//                          GShield (Game Shield)
//=============================================================================
//
// Original Programmer: Shawn Jackson
// Company: WaveTech Digital Technologies, Inc. (http://www.wtdt.com)
// Copyright: (c) 2006 WaveTech Digital Technologies, Inc. All Rights Reserved.
// Assembly: Library
// Code File Name: GameRatingDetail.cs
// Code File Date: 10/22/2006
//
// Code File Info: Class representing the data of a game rating detail.
//=============================================================================
/*
 * UPDATES
 * -------
 *			ShawnJ 8/7/2007 (0.9.5.x): Code Commenting.
 */
#endregion Header

#region License
/*
  GShield - Game Shield
  Copyright (C) 2006-2007 WaveTech Digital Technologies, Inc.
                                http://www.wtdt.com

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
#endregion License

#region Includes

using System;
using System.Globalization;
using System.Runtime.Serialization;
using WaveTech.GShield.Library.Enumerations;
#endregion Includes

namespace WaveTech.GShield.Library.Objects
{
	/// <summary>
	/// Object containing the details of a game
	/// rating from the ESRB system.
	/// </summary>
	[Serializable]
	[DataContract]
	public class GameRatingDetail
	{
		#region Public Properties
		/// <summary>
		/// Name of the game for the rating
		/// </summary>
		[DataMember]
		public string Name { get; set; }

		/// <summary>
		/// Publisher of the game from the ESRB site
		/// </summary>
		[DataMember]
		public string Publisher { get; set; }

		/// <summary>
		/// Rating of the game (ESRB Code)
		/// </summary>
		[DataMember]
		public string Rating { get; set; }

		/// <summary>
		/// Game content descriptions, seperated by comma
		/// </summary>
		[DataMember]
		public string Content { get; set; }

		/// <summary>
		/// Platforms for the game
		/// </summary>
		[DataMember]
		public string Platforms { get; set; }

		/// <summary>
		/// Is this response exact, only one or all the same
		/// </summary>
		[DataMember]
		public bool? Exact { get; set; }
		#endregion Public Properties

		#region Constructors
		public GameRatingDetail()
		{

		}

		public GameRatingDetail(string name, string publisher, string rating, string content, string platforms)
		{
			Name = name;
			Publisher = publisher;
			Rating = rating;
			Content = content;
			Platforms = platforms;
		}
		#endregion Constructors

		#region Get Rating Type
		/// <summary>
		/// Gets the GShield RatingTime enumeration based on the
		/// ESRB rating string code (T, E, M, AO, etc)
		/// </summary>
		/// <returns>Rating Type based on ESRB rating code</returns>
		public RatingType GetRatingType()
		{
			if (String.Compare(Rating.Trim(), "ec", true, CultureInfo.InvariantCulture) == 0)
				return RatingType.EarlyChildhood;
			else if (String.Compare(Rating.Trim(), "e", true, CultureInfo.InvariantCulture) == 0)
				return RatingType.Everyone;
			else if (String.Compare(Rating.Trim(), "e10+", true, CultureInfo.InvariantCulture) == 0)
				return RatingType.Everyone10Plus;
			else if (String.Compare(Rating.Trim(), "t", true, CultureInfo.InvariantCulture) == 0)
				return RatingType.Teen;
			else if (String.Compare(Rating.Trim(), "m", true, CultureInfo.InvariantCulture) == 0)
				return RatingType.Mature;
			else if (String.Compare(Rating.Trim(), "ao", true, CultureInfo.InvariantCulture) == 0)
				return RatingType.AdultsOnly;
			else
				return RatingType.Unknown;
		}
		#endregion Get Rating Type
	}
}